package pandora.box.usuarioempresa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import tabelas.controle.Uf.UF;

@Entity
@Table(name="USUARIOEMPRESA")
public class UsuarioEmpresa implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="idUSUARIOEMPRESA")
	private Integer idusuarioempresa;
	
	@Column(name="NUMCNPJ", nullable=false, length=20, unique=true)
	private String numcnpj;
	
	@Column(name="NMRAZAOSOCIAL", nullable=false, length=100, unique=true)
	private String nmrazaosocial;
	
	@Column(name="NMFANTASIA", nullable=false, length=100)
	private String nmfantasia;
	
	@Column(name="NUMINSCESTADUAL", nullable=false, length=30)
	private String numinscestadual;
	
	@Column(name="DSENDERECO", nullable=false, length=400)
	private String dsendereco;
	
	@Column(name="DSBAIRRO", nullable=false, length=100)
	private String dsbairro;
	
	@Column(name="NUCEP", nullable=false, length=15)
	private String nucep;
	
	@Column(name="DSCIDADE", nullable=false, length=45)
	private String dscidade;
	
	@ManyToOne
	@JoinColumn(name="idUF")
	private UF uf;
	
	@Column(name="NUFONE01", nullable=false, length=15)
	private String nufone01;
	
	@Column(name="NUFONE02", nullable=false, length=15)
	private String nufone02;
	
	@Column(name="NUFONE03", nullable=false, length=15)
	private String nufone03;
	
	@Column(name="NMRESPONSAVEL", nullable=false, length=100)
	private String nmresponsavel;
	
	@Column(name="USUARIOINCLUSAO", nullable=false, length=30)
	private String usuarioinclusao;
	
	@Column(name="DTINCLUSAO", nullable=false)
	private Date dtinclusao;
	
	@Column(name="USUARIOALTERACAO", nullable=true, length=30)
	private String usuarioalteracao;
	
	@Column(name="DTALTERACAO", nullable=true)
	private Date dtalteracao;
	
	@Column(name="BOLATIVO", nullable=false, length=1)
	private char bolativo;
	
	@Column(name="EMAILCONTATO", nullable=false, length=100)
	private String emailcontato;

	public Integer getIdusuarioempresa() {
		return idusuarioempresa;
	}

	public void setIdusuarioempresa(Integer idusuarioempresa) {
		this.idusuarioempresa = idusuarioempresa;
	}

	public String getNumcnpj() {
		return numcnpj;
	}

	public void setNumcnpj(String numcnpj) {
		this.numcnpj = numcnpj;
	}

	public String getNmrazaosocial() {
		return nmrazaosocial;
	}

	public void setNmrazaosocial(String nmrazaosocial) {
		this.nmrazaosocial = nmrazaosocial.toUpperCase();
	}

	public String getNmfantasia() {
		return nmfantasia;
	}

	public void setNmfantasia(String nmfantasia) {
		this.nmfantasia = nmfantasia.toUpperCase();
	}

	public String getNuminscestadual() {
		return numinscestadual;
	}

	public void setNuminscestadual(String numinscestadual) {
		this.numinscestadual = numinscestadual;
	}

	public String getDsendereco() {
		return dsendereco;
	}

	public void setDsendereco(String dsendereco) {
		this.dsendereco = dsendereco.toUpperCase();
	}

	public String getDsbairro() {
		return dsbairro;
	}

	public void setDsbairro(String dsbairro) {
		this.dsbairro = dsbairro.toUpperCase();
	}

	public String getNucep() {
		return nucep;
	}

	public void setNucep(String nucep) {
		this.nucep = nucep;
	}

	public String getDscidade() {
		return dscidade;
	}

	public void setDscidade(String dscidade) {
		this.dscidade = dscidade.toUpperCase();
	}

	public UF getUf() {
		return uf;
	}

	public void setUf(UF uf) {
		this.uf = uf;
	}

	public String getNufone01() {
		return nufone01;
	}

	public void setNufone01(String nufone01) {
		this.nufone01 = nufone01;
	}

	public String getNufone02() {
		return nufone02;
	}

	public void setNufone02(String nufone02) {
		this.nufone02 = nufone02;
	}

	public String getNufone03() {
		return nufone03;
	}

	public void setNufone03(String nufone03) {
		this.nufone03 = nufone03;
	}

	public String getNmresponsavel() {
		return nmresponsavel;
	}

	public void setNmresponsavel(String nmresponsavel) {
		this.nmresponsavel = nmresponsavel.toUpperCase();
	}

	public String getUsuarioinclusao() {
		return usuarioinclusao;
	}

	public void setUsuarioinclusao(String usuarioinclusao) {
		this.usuarioinclusao = usuarioinclusao.toUpperCase();
	}

	public Date getDtinclusao() {
		return dtinclusao;
	}

	public void setDtinclusao(Date dtinclusao) {
		this.dtinclusao = dtinclusao;
	}

	public String getUsuarioalteracao() {
		return usuarioalteracao;
	}

	public void setUsuarioalteracao(String usuarioalteracao) {
		this.usuarioalteracao = usuarioalteracao.toUpperCase();
	}

	public Date getDtalteracao() {
		return dtalteracao;
	}

	public void setDtalteracao(Date dtalteracao) {
		this.dtalteracao = dtalteracao;
	}

	public char getBolativo() {
		return bolativo;
	}

	public void setBolativo(char bolativo) {
		this.bolativo = bolativo;
	}

	public String getEmailcontato() {
		return emailcontato;
	}

	public void setEmailcontato(String emailcontato) {
		this.emailcontato = emailcontato.toLowerCase();
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + bolativo;
		result = prime * result
				+ ((dsbairro == null) ? 0 : dsbairro.hashCode());
		result = prime * result
				+ ((dscidade == null) ? 0 : dscidade.hashCode());
		result = prime * result
				+ ((dsendereco == null) ? 0 : dsendereco.hashCode());
		result = prime * result
				+ ((dtalteracao == null) ? 0 : dtalteracao.hashCode());
		result = prime * result
				+ ((dtinclusao == null) ? 0 : dtinclusao.hashCode());
		result = prime * result
				+ ((emailcontato == null) ? 0 : emailcontato.hashCode());
		result = prime
				* result
				+ ((idusuarioempresa == null) ? 0 : idusuarioempresa.hashCode());
		result = prime * result
				+ ((nmfantasia == null) ? 0 : nmfantasia.hashCode());
		result = prime * result
				+ ((nmrazaosocial == null) ? 0 : nmrazaosocial.hashCode());
		result = prime * result
				+ ((nmresponsavel == null) ? 0 : nmresponsavel.hashCode());
		result = prime * result + ((nucep == null) ? 0 : nucep.hashCode());
		result = prime * result
				+ ((nufone01 == null) ? 0 : nufone01.hashCode());
		result = prime * result
				+ ((nufone02 == null) ? 0 : nufone02.hashCode());
		result = prime * result
				+ ((nufone03 == null) ? 0 : nufone03.hashCode());
		result = prime * result + ((numcnpj == null) ? 0 : numcnpj.hashCode());
		result = prime * result
				+ ((numinscestadual == null) ? 0 : numinscestadual.hashCode());
		result = prime * result + ((uf == null) ? 0 : uf.hashCode());
		result = prime
				* result
				+ ((usuarioalteracao == null) ? 0 : usuarioalteracao.hashCode());
		result = prime * result
				+ ((usuarioinclusao == null) ? 0 : usuarioinclusao.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UsuarioEmpresa other = (UsuarioEmpresa) obj;
		if (bolativo != other.bolativo)
			return false;
		if (dsbairro == null) {
			if (other.dsbairro != null)
				return false;
		} else if (!dsbairro.equals(other.dsbairro))
			return false;
		if (dscidade == null) {
			if (other.dscidade != null)
				return false;
		} else if (!dscidade.equals(other.dscidade))
			return false;
		if (dsendereco == null) {
			if (other.dsendereco != null)
				return false;
		} else if (!dsendereco.equals(other.dsendereco))
			return false;
		if (dtalteracao == null) {
			if (other.dtalteracao != null)
				return false;
		} else if (!dtalteracao.equals(other.dtalteracao))
			return false;
		if (dtinclusao == null) {
			if (other.dtinclusao != null)
				return false;
		} else if (!dtinclusao.equals(other.dtinclusao))
			return false;
		if (emailcontato == null) {
			if (other.emailcontato != null)
				return false;
		} else if (!emailcontato.equals(other.emailcontato))
			return false;
		if (idusuarioempresa == null) {
			if (other.idusuarioempresa != null)
				return false;
		} else if (!idusuarioempresa.equals(other.idusuarioempresa))
			return false;
		if (nmfantasia == null) {
			if (other.nmfantasia != null)
				return false;
		} else if (!nmfantasia.equals(other.nmfantasia))
			return false;
		if (nmrazaosocial == null) {
			if (other.nmrazaosocial != null)
				return false;
		} else if (!nmrazaosocial.equals(other.nmrazaosocial))
			return false;
		if (nmresponsavel == null) {
			if (other.nmresponsavel != null)
				return false;
		} else if (!nmresponsavel.equals(other.nmresponsavel))
			return false;
		if (nucep == null) {
			if (other.nucep != null)
				return false;
		} else if (!nucep.equals(other.nucep))
			return false;
		if (nufone01 == null) {
			if (other.nufone01 != null)
				return false;
		} else if (!nufone01.equals(other.nufone01))
			return false;
		if (nufone02 == null) {
			if (other.nufone02 != null)
				return false;
		} else if (!nufone02.equals(other.nufone02))
			return false;
		if (nufone03 == null) {
			if (other.nufone03 != null)
				return false;
		} else if (!nufone03.equals(other.nufone03))
			return false;
		if (numcnpj == null) {
			if (other.numcnpj != null)
				return false;
		} else if (!numcnpj.equals(other.numcnpj))
			return false;
		if (numinscestadual == null) {
			if (other.numinscestadual != null)
				return false;
		} else if (!numinscestadual.equals(other.numinscestadual))
			return false;
		if (uf == null) {
			if (other.uf != null)
				return false;
		} else if (!uf.equals(other.uf))
			return false;
		if (usuarioalteracao == null) {
			if (other.usuarioalteracao != null)
				return false;
		} else if (!usuarioalteracao.equals(other.usuarioalteracao))
			return false;
		if (usuarioinclusao == null) {
			if (other.usuarioinclusao != null)
				return false;
		} else if (!usuarioinclusao.equals(other.usuarioinclusao))
			return false;
		return true;
	}
	
	/**
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
    @JoinTable(name="fk_USUARIOEMPRESA_USUARIO", joinColumns={@JoinColumn(name="idUSUARIO", referencedColumnName="idUSUARIO")}, inverseJoinColumns={@JoinColumn(name="idUSUARIO", referencedColumnName="idUSUARIO")})
	private List usuariolist;
	
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
    @JoinTable(name="fk_USUARIOEMPRESA_RAMOATIVIDADE", joinColumns={@JoinColumn(name="idRAMOATIVIDADE", referencedColumnName="idRAMOATIVIDADE")}, inverseJoinColumns={@JoinColumn(name="idRAMOATIVIDADE", referencedColumnName="idRAMOATIVIDADE")})
	private List ratividadelist;	
**/
		
}
